package com.feicheng.lanniao.controller;


import java.time.LocalDateTime;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.feicheng.lanniao.entity.HouseLease;
import com.feicheng.lanniao.entity.HouseRentInfo;
import com.feicheng.lanniao.result.ResultInfo;
import com.feicheng.lanniao.service.IHouseRentClientVoService;

/**
 * <p>
 * VIEW 前端控制器
 * </p>
 *
 * @author feichengTech
 * @since 2021-09-07
 */
@RestController
@RequestMapping("/lanniao-admin/house-rent-client-vo")
public class HouseRentClientVoController {
	@Autowired
	private IHouseRentClientVoService iHouseRentClientVoService;
	/**
	 * 求租列表查询
	 * @param title 标题
	 * @param detail 详情
	 * @param clientId 用户id
	 * @param currentPage 当前页
	 * @param pageSize 每页多少条
	 * @return 求租列表集合
	 */
	@GetMapping("/page")
	public ResultInfo getRentClientPage(
			String title, 
			String detail,
			Integer clientId ,
		   @RequestParam(defaultValue = "1") Integer currentPage,
		   @RequestParam(defaultValue = "10") Integer pageSize) {
		return iHouseRentClientVoService.getRentClientPage(title,detail,
				clientId, currentPage, pageSize);
	}
	/**
	 * 求租详情
	 * @param houseRentId 求租房id
	 * @return 求租详情
	 */
	@GetMapping("/info")
	public ResultInfo findDetails(Integer houseRentId) {
		return iHouseRentClientVoService.findDetails(houseRentId);
	}
	/**
	 * 新增求租信息
	 * @param title 标题
	 * @param detail 详情
	 * @param clientId 用户id
	 * @param tel 发布人电话
	 * @param wxNumber 发布人微信
	 * @return 返回布尔结果 true-成功 false-失败
	 */
	@PostMapping("/info")
	public ResultInfo addRentClient(String tel,String wxNumber,String title,String detail,
			Integer clientId){
		return iHouseRentClientVoService.addRentClient(tel,wxNumber,title,detail,
			clientId);
	}
	/**
	 * 修改求租信息
	 * @param houseRentId 求租房id
	 * @param title 标题
	 * @param detail 详情
	 * @param personName 客户名字
	 * @param phone 客户电话
	 * @param clientId 用户id
	 * @return 返回布尔结果 true-成功 false-失败
	 */
	@PutMapping("/info")
	public ResultInfo updateRentClient(Integer houseRentId,String title,String detail,
			String tel,String wxNumber,Integer clientId) {
		return iHouseRentClientVoService.updateRentClient(houseRentId,title,detail,
				tel,wxNumber,clientId);
	}
	/**
	 * 删除求租信息
	 * @param houseRentInfo 求租房对象
	 * @return 返回布尔结果 true-成功 false-失败
	 */
	@DeleteMapping("/info")
	public ResultInfo deleteHouseLeaseClient(HouseRentInfo houseRentInfo) {
		return iHouseRentClientVoService.deleteHouseLeaseClient(houseRentInfo);
	}

}

